import { S } from '../../s';
import { IPSAppDEAction } from './ipsapp-deaction';
import { IPSAppDEActionLogic } from './ipsapp-deaction-logic';
import { IPSAppDELogic } from './ipsapp-delogic';
import { IPSAppDEMethodLogic } from './ipsapp-demethod-logic';
import { IPSAppDataEntity } from './ipsapp-data-entity';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSAppDEMethodLogicImpl
  extends PSModelObjectImpl
  implements IPSAppDEMethodLogic, IPSAppDEActionLogic
{
  get actionLogicType():
    | 1
    | 0
    | 2
    | 3
    | 4
    | 5
    | 6
    | 7
    | 8
    | 9
    | 10
    | 50
    | 51
    | 52
    | 53
    | 54
    | 55
    | 56 {
    return this.M.actionLogicType != null ? this.M.actionLogicType : -1;
  }

  get attachMode(): 'PREPARE' | 'CHECK' | 'BEFORE' | 'AFTER' {
    return this.M.attachMode;
  }

  protected dstpsappdeaction: IPSAppDEAction;
  getDstPSAppDEAction(): IPSAppDEAction | null {
    if (this.dstpsappdeaction != null) return this.dstpsappdeaction;
    const value = this.M.getDstPSAppDEAction;
    if (value == null) {
      return;
    }
    this.dstpsappdeaction =
      this.getDstPSAppDataEntity().findPSAppDEAction(value);
    return this.dstpsappdeaction;
  }

  protected dstpsappdataentity: IPSAppDataEntity;
  getDstPSAppDataEntity(): IPSAppDataEntity | null {
    return (
      this.dstpsappdataentity ||
      (this.dstpsappdataentity = this.fillObjectModel(
        S._f,
        this.M.getDstPSAppDataEntity,
        S._321,
      ) as IPSAppDataEntity)
    );
  }

  protected psappdelogic: IPSAppDELogic;
  getPSAppDELogic(): IPSAppDELogic | null {
    if (this.psappdelogic != null) return this.psappdelogic;
    const value = this.M.getPSAppDELogic;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getParentPSModelObject(
      S._f,
    ) as IPSAppDataEntity;
    if (ipsappdataentity != null) {
      this.psappdelogic = ipsappdataentity.findPSAppDELogic(value);
    }
    return this.psappdelogic;
  }

  get scriptCode(): string {
    return this.M.scriptCode;
  }

  get cloneParam(): boolean {
    return this.M.cloneParam != null ? this.M.cloneParam : false;
  }

  get ignoreException(): boolean {
    return this.M.ignoreException != null ? this.M.ignoreException : false;
  }

  get internalLogic(): boolean {
    return this.M.internalLogic != null ? this.M.internalLogic : false;
  }
  get cls(): string {
    return 'PSAppDEMethodLogicImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._387 || cls == S._388) return true;
    return super.instanceof(cls);
  }
}
